﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;


namespace TankBattle.Models
{
    public class GameSound
    {
        #region variable

        private List<SoundEffect> sounds;
        #endregion 

        public GameSound()
        {
            sounds = new List<SoundEffect>();
        }
        public void AddSound(SoundEffect sound)
        {
            sounds.Add(sound);
        }
        public void PlaySound(int sound)
        {
            if (sound < sounds.Count)
                sounds[sound].Play();
        }
        public void StopSound(int sound)
        {
            if (sound < sounds.Count)
                sounds[sound].CreateInstance().Stop();
        }
        public void SetLoop(int sound, bool isLoop)
        {
            if (sound < sounds.Count)
                sounds[sound].CreateInstance().IsLooped = isLoop;
        }
    }
}
